package com.boot.security.server.dao.order;

import java.util.List;
import java.util.Map;

import com.boot.security.server.model.order.TswOrderDetails;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;



@Mapper
public interface TswOrderDetailsDao {

    @Select("select * from tsw_order_details t where t.id = #{id}")
    TswOrderDetails getById(Long id);

    @Delete("delete from tsw_order_details where id = #{id}")
    int delete(Long id);

    int update(TswOrderDetails tswOrderDetails);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_order_details(order_id, product_id, product_number, specifications_id, product_price, actual_price, mail_id, sycee_total, sycee_number, mall_type, buyer_message, whether, subtotal, details_note, details_remark) values(#{orderId}, #{productId}, #{productNumber}, #{specificationsId}, #{productPrice}, #{actualPrice}, #{mailId}, #{syceeTotal}, #{syceeNumber}, #{mallType}, #{buyerMessage}, #{whether}, #{subtotal}, #{detailsNote}, #{detailsRemark})")
    int save(TswOrderDetails tswOrderDetails);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswOrderDetails> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
